package com.jg.visitor.controller.enums;

import java.util.Arrays;

public enum VisitorRecordOperationEnum {
    ADD_NEW_RECORD(1,"新增申请单"),
    INTERVIEWEE_APPROVED(2,"被访者审批"),
    SAFER_APPROVED(3,"安全员审批"),
    SIGN_IN(4,"签到"),
    SIGN_OUT(5,"签退"),
    CANCEL(6,"取消");

    private final Integer operationCode;
    private final String operationName;

    VisitorRecordOperationEnum(Integer statusCode,String statusName){
        this.operationCode = statusCode;
        this.operationName = statusName;
    }

    public Integer getOperationCode() {
        return operationCode;
    }

    public String getOperationName() {
        return operationName;
    }

    public static String getOperationTypeNameByCode(Integer operationCode){
        return Arrays
                .stream(VisitorRecordOperationEnum.values())
                .filter(operation -> operation.getOperationCode().equals(operationCode))
                .map(VisitorRecordOperationEnum::getOperationName)
                .findAny()
                .orElse(null);
    }
}
